package com.example.jin.myapplication.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by jin on 2016/6/2.
 */
public class CrimeDatabaseHelper extends SQLiteOpenHelper{
    private final static int DATABSE_VERSION=1;
    private final static String DATABASE_NAME="crime.db";
    public CrimeDatabaseHelper(Context context){
        super(context,DATABASE_NAME,null,DATABSE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.i("main","CrimeDatabaseHelper.onCreate");
        db.execSQL("create table "+CrimeDbSchema.CrimeTable.NAME+"(" +
                    "_id integer primary key autoincrement,"+
                    CrimeDbSchema.CrimeTable.Cols.UUID+" text,"+
                    CrimeDbSchema.CrimeTable.Cols.TITLE+" text,"+
                    CrimeDbSchema.CrimeTable.Cols.DATE+" integer,"+
                    CrimeDbSchema.CrimeTable.Cols.SOLVED+ " integer)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.i("main","CrimeDatabaseHelper.onUpgrade from:"+oldVersion+" to:"+newVersion);
    }
}
